Skip to content

Conversation

@cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Sep 25, 2025

This PR modifies the existing linear DipEdge element to support the nonlinear map of:

K. Hwang and S. Y. Lee, "Dipole fringe field map for compact synchrotrons," Phys. Rev. Accel. Beams 18, 122401 (2015)

The map is expressed in the explicit, symplectic form provided in:

C. Mitchell and K. Hwang, "Explicit symplectic representations of nonlinear dipole fringe field maps," in Proc. NAPAC2025, TUP040, Sacramento, CA, 2025.

  • set up modified DipEdge element inputs
  • add intermediate variable definitions
  • implement nonlinear map
  • update default values for field integral inputs
  • double-check map implementation
  • add entry/exit input flag
  • update documentation
  • add benchmark tests
  • update benchmark tolerance

@cemitch99 cemitch99 requested review from ax3l and qianglbl September 25, 2025 18:09
@cemitch99
Copy link
Member Author

The three failing tests are due to the Dashboard, and appear to be unrelated to this PR.

@ax3l ax3l self-assigned this Oct 30, 2025
Probably worth vectorizing now...
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

I added formatting fixes (applying them now), small code suggestions (leaving for your review) and a final suggestion for he user-facing API that I can help with.

Comment on lines +309 to +310
int m_model; //! model specification
Location m_flag; //! +1 for entry, or -1 for exit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a final update, I would like to make m_model and m_flag AMREX_ENUM as we do for SpaceChargeAlgo.

The reason is that I would like users to write in their input files / scripts a descriptive string or type instead of integers that one has to look up.

What would be good string values for each of those?
I assume:

  • model: "linear", "order6" ?
  • location: "entry", "exit"

Also would call m_flag simply m_location.

Copy link
Member Author

@cemitch99 cemitch99 Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree m_location works well, with entry and exit as string values. For m_model, I would just use linear and nonlinear. The question of "order" is subtle here, and unrelated to the values of K0-K6 above (which is where I assume the number 6 originated).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that "flag" (which can be renamed "location") is already specified here by a user-provided string (not an integer) with values "entry" and "exit" using enum in lines 47-51 of DipEdge.H. Can you clarify the advantage of changing this to an implementation similar to SpaceChargeAlgo (e.g., lines 21-26 of Algorithms.H)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants